<template>
  <div>
    <el-dialog
      title="查看上级"
      :visible.sync="SuperiorShow"
      @click="onClose"
      width="40%"
      center
    >   <el-scrollbar style="height:450px;">
      <div class="mainBox">
     
        <el-timeline>
          <el-timeline-item
            v-for="(item, index) in CheckSuperiorData"
            :key="item.userId"
          >
            <div slot="dot" class="tbBox">
              <div
                class="tbBox_img"
                v-show="CheckSuperiorData.length == index + 1"
              >
                <span>当前位置</span>
              </div>
              <span> {{ index + 1 }}</span>
            </div>
            <span style="margin-left: 10px" :class="CheckSuperiorData.length == index + 1?'lanseText':''"> {{ item.userName }}</span>
          </el-timeline-item>
        </el-timeline>
      
      </div>
        </el-scrollbar>
    </el-dialog>
  </div>
</template>
<script>
import { selectByHierarchy } from "@/api/base/index.js";
export default {
  props: ["IdData"],
  components: {},
  data() {
    return {
      CheckSuperiorData: [],
      SuperiorShow: false,
      // 查看上级数据显示的最后一位
      CheckSuperiorNumber: "",
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {
    // this.gitData();
    // this.components=true;
  },
  methods: {
    onClose(){},
    async gitData() {
      this.SuperiorShow = true;
      this.$nextTick(async () => {
        const { data } = await selectByHierarchy({ userId: this.IdData });
        this.CheckSuperiorData = data;
        this.CheckSuperiorNumber = data.length - 1;
      });
    },
    handelConfirm() {
      this.$refs["elForm"].validate((valid) => {
        if (!valid) return;
        this.close();
      });
    },
  },
};
</script>
<style scoped lang='scss'>
//弹窗在屏幕中间
::v-deep .el-dialog__wrapper {
   display: flex;
   justify-content: center;
   align-items: center;
}
::v-deep .el-dialog:not(.is-fullscreen) {
  margin-top: 0vh !important;
}
//线条左右
::v-deep .el-timeline-item__tail {
  left: 15px;
}
//线条长度
::v-deep .el-timeline-item{
  padding-bottom: 57px;
}
//文字
::v-deep .el-timeline-item__wrapper{
  top:5px;
}
.mainBox {
  // border: 1px red solid;
  height: auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 40px;
  .tbBox {
    height: 30px;
    width: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(255, 255, 255);
    // border:1px red solid;
    background: rgb(90, 138, 245);
    box-shadow: 0px 0px 10px 0px rgb(0, 81, 255);
    position: relative;
    .tbBox_img {
      position: absolute;
      height: 35px;
      font-size: 13px;
      width: 65px;
      // border: 1px red solid;

      margin-top: -50px;
      // background: red;
      background: url(../../assets/img/yjjx.png) no-repeat center;
      background-size: 100% 30px;
      display: flex;
      justify-content: center;
      //  background-size: contain;
      span {
        margin-top: 5px;
        padding-left:5px;
        height: auto;
        width: 100%;
        // border: 1px red solid;
      }
    }
  }
  .lanseText{
    color: rgb(90, 138, 245);
  }
}

::v-deep .el-dialog__header {
  border-bottom: 1px solid #eeeeee;
  width: 90%;
  margin: auto;
  padding-left: 0;
}
</style>
<style>
body .el-scrollbar__wrap {
  overflow-x: hidden;
  /* //隐藏横向滚动条   */
}

/* 但是隐藏横向滚动条样式会导致element 下拉框最后一位显示不完整，为了避免这个问题，再加上 */
.el-select-dropdown .el-scrollbar .el-scrollbar__wrap {
  overflow: scroll !important;
}
</style>
<style scoped lang="scss">
.box {
  // border: 1px red solid;
  padding-bottom: 10px;
  // border-bottom: 1px rgb(104, 104, 104) solid;
  margin-bottom: 10px;
  .hadeBox {
    //  border: 1px red solid;
    display: flex;
    flex-direction: column;
    .hadeText {
    }
  }
  .textBox {
    margin-top: 10px;
    border: 1px rgb(182, 182, 182) dashed;
    border-radius: 7px;
    padding: 10px;
  }
}
</style>
